//1.手写题：https://bigfrontend.dev/zh/problem/implement-Object.is
/**
 * @param {any} a
 * @param {any} b
 * @return {boolean}
 */
function is(a, b) {
    // your code here
    if (typeof a === typeof b && typeof a === 'number') {
        if (a == b && a == 0) {
            return 1 / a === 1 / b
        }
        a += ''
        b += ''
    }
    return a === b
}



//2.编程题 394. 字符串解码 https://leetcode-cn.com/problems/decode-string/
/**
 * @param {string} s
 * @return {string}
 */
var decodeString = function (s) {
    let mulStack = [], strStack = [], num = 0, res = ''
    for (const c of s) {
        if (/\d/.test(c)) {
            num = num * 10 + Number(c); // 算出倍数
        } else if (/\[/.test(c)) {
            strStack.push(res)
            mulStack.push(num)
            res = ''
            num = 0
        } else if (/\]/.test(c)) {
            res = strStack.pop() + res.repeat(mulStack.pop())
        } else {
            res += c
        }
    }
    return res;
};